import request from '@/utils/request';
import type { AxiosResponse } from 'axios';

const baseModule = '/dict';

/**
 * 查询数据字典类型
 * @param name 参数
 * @returns {Promise<AxiosResponse<T>>}
 */
export const getListType = (): Promise<AxiosResponse<API.IResult>> => {
  return request({
    url: `${baseModule}/listType`,
    method: 'post',
  });
};

/**
 * 分页查询字典数据
 * @param params
 * @auther: Herther
 * @since 1.0.0
 * @date: 2022/9/20 23:35
 */
export const getDictListPage = (params: any): Promise<AxiosResponse<API.IResult>> => {
  return request({
    url: `${baseModule}/list`,
    method: 'post',
    data: params,
  });
};

/**
 * 根据id查询字典详情
 * @param id 登录详情id
 * @return  {Promise<AxiosResponse<T>>}
 * @author: Herther
 * @since 1.0.0
 * @date: 2022/9/12 15:34
 */
export const getDetail = (id: number) => {
  return request({
    url: `${baseModule}/get/${id}`,
    method: 'get',
  });
};
